package com.example.membersteward.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class FileConfig implements WebMvcConfigurer {
    @Value("${resource.imgPath}")
    private String IMG_PATH;
    @Value("${resource.virtualPath}")
    private String VIRTUAL_PATH;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler(VIRTUAL_PATH + "**").addResourceLocations("file:" + IMG_PATH);
    }
}
